<!DOCTYPE html>
{% load static %}
{% load djadmin_tags %}
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>{% block title %}Feiu CRM后台管理系统{% endblock %}</title>
    <!-- Bootstrap core CSS -->
    <link href="{% static 'bootstrap-3.3.7/css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="{% static 'bootstrap-3.3.7/css/ie10-viewport-bug-workaround.css' %}" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="{% static 'bootstrap-3.3.7/css/dashboard.css' %}" rel="stylesheet">
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <script src="{% static 'bootstrap-3.3.7/js/ie-emulation-modes-warning.js' %}"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    {% block css %}{% endblock %}
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">FeiuCRM系统管理</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">功能</a></li>
                {% if request.user.is_authenticated %}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ request.user }}<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">用户信息</a></li>
                            <li role="separator" class="divider"></li>
                            <li class="dropdown-header">当前用户：{{ request.user }}</li>
                            <li><a href="{% url 'djadmin:user_logout' %}">退出登录</a></li>
                        </ul>
                    </li>
                {% else %}
                    <li><a href="{% url 'djadmin:user_login' %}">点击登录</a></li>
                {% endif %}
            </ul>
<form class="navbar-form navbar-right">
    <input name="_kw" type="text" class="form-control" placeholder="Search..." value="{{ keyword }}">
</form>
        </div>
    </div>
</nav>

<div class="container-fluid">
    {% block body %}
        <div class="row">
            <div class="col-sm-3 col-md-2 sidebar">
                <ul class="nav nav-sidebar">
                   {% url 'djadmin:index' as djadmin_index %}
                    <li {% if request.path == djadmin_index %} class="active" {% endif %}><a href="{{ djadmin_index }}">后台首页</a></li>
                    {# request.user.userprofile.role.select_related #}
                    {% for role in request.user.userprofile.role.all %}
                        {% for menu in role.menus.all %}
                            {% if menu.url_type == 0 %}
                                <li {% if request.path == menu.url %} class="active" {% endif %}><a href="{{ menu.url }}">{{ menu.name }}</a></li>
                            {% else %}
                                {% url menu.url as menu_dynamic_url %}
                                <li {% if request.path == menu_dynamic_url %} class="active" {% endif %}><a href="{{ menu_url }}">{{ menu.name }}</a></li>
                            {% endif %}
                        {% endfor %}
                    {% endfor %}
                </ul>
            </div>
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                {% block content %}
                {% endblock %}
            </div>
        </div>
    {% endblock body %}
</div>

<!-- Placed at the end of the document so the pages load faster -->
<script src="{% static 'bootstrap-3.3.7/js/jquery.min.js' %}"></script>
<script src="{% static 'bootstrap-3.3.7/js/bootstrap.min.js' %}"></script>
<!-- Just to make our placeholder images work. Don't actually copy the next line! -->
<script src="{% static 'bootstrap-3.3.7/js/holder.min.js' %}"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{% static 'bootstrap-3.3.7/js/ie10-viewport-bug-workaround.js' %}"></script>
{% block js %}{% endblock %}
</body>
</html>